﻿using OpenLibrary.Domain.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using OpenLibrary.Infrastructure.Repositories;
using OpenLibrary.Domain.Models;

namespace OpenLibrary.Web.Controllers
{
    public class PublishersController : Controller
    {
        //
        // GET: /Publishers/

        IPublisherRepository _repository;

        public PublishersController()
        {
            _repository = new PublisherRepository();
        }

        public ActionResult Create()
        {
            return View("Create", new Publisher());
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Create(Publisher publisher)
        {
            _repository.Create(publisher);

            return View("Details", publisher);    
        }

    }
}
